<template>
  <div>
    <div style="width: 100%;">
      <span>推广文案</span>
      <span style="margin-left: 60%;">
        <el-button type="primary" @click="submit()">提交</el-button>
        </span>
      <!-- <span><el-button type="primary">日访问量</el-button></span>
      <span><el-button type="primary">同步网站</el-button></span>
      <span><el-button type="primary">保存并且新建</el-button></span> -->
    </div>
    <div style="width: 100%; margin-top: 40px;">
      <div style="margin-left:45%; color: rgb(68, 150, 254); font-size: 25px; ">推广文案</div>
      <div>
        <div style="margin: 20px;"></div>
        <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
          <el-form-item label="标题">
            <el-input v-model="title"></el-input>
          </el-form-item>
          <el-form-item label="作者">
            <el-input v-model="author"></el-input>
          </el-form-item>
          <el-form-item label="分类">
            <el-input v-model="category"></el-input>
            <!-- <el-select v-model="category" placeholder="请选择活动类型" style="width: 100%;">
              <el-option label=" 外部网站" value="shanghai"></el-option>
              <el-option label="公众号" value="beijing"></el-option>
              <el-option label="小程序" value="shanghai"></el-option>
              <el-option label="朋友圈" value="beijing"></el-option>
              <el-option label="贴吧论坛" value="shanghai"></el-option>
            </el-select> -->
          </el-form-item>
          <div style="margin-left: 4%;">内容</div>
        </el-form>
        <div style="width: 100%;">
          <div style="margin-left: rem;">
            <tinymce :width="595" :height="300" v-model="content" :key="tinymceFlag">
            </tinymce>
          </div>
        </div>
        <div style="width: 100%;height: 500px;">
          <div style="margin-top: 40px;">
            <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
            </el-form>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {addcontent,delPlan} from "../../../api/research"
import Tinymce from "@/components/Tinymce";
const defaultEditForm = {
  id: null,
  name: null,
  introductionThe: null,
  createTime: null,
  updateTime: null,
};
const defaultListQuery = {
  pageNum: 1,
  pageSize: 10,
  isAsc: false,
  orderByField: "create_time",
};
export default {
  components: { Tinymce },
  data() {
    return {

      title:null,
      author:null,
      category:null,
      content:null,

      // 流程图
      active: 0,
      value: "",
      sizeForm: {
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: ''
      },
      loading: false, //是显示加载
      editFormVisible: false, //控制编辑页面显示与隐藏
      isEdit: false,
      total: "",
      tinymceFlag: 1,
      editForm: Object.assign({}, defaultEditForm),
      // rules表单验证
      rules: {
        name: [{ required: true, message: "请输入名称", trigger: "blur" }],
      },
      listData: [], //数据
      list: Object.assign({}, defaultListQuery),




      sizeForm: {
        name: ''
      },
      labelPosition: 'right',
      formLabelAlign: {
        name: '',
        region: '',
        type: ''
      },
      form: {
        region1: ''
      }
    }
  },
  methods: {
    submit(){
      const addplan = {
      title:this.title,
      author:this.author,
      category:this.category,
      content:this.content,
      }
      console.log(addplan);

      addcontent(addplan).then(res=>{
        console.log(res)
        if(res.code==200){
          this.$message.success(res.message)
        }else{
          this.$message.error(res.message)
        }

    })
  },

},
}
</script>

<style scoped></style>
